package com.neusoft.my12306.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.neusoft.my12306.common.res.CommonResult;
import com.neusoft.my12306.entity.Schedule;
import com.neusoft.my12306.entity.Station;
import com.neusoft.my12306.mapper.StationMapper;
import com.neusoft.my12306.service.IStationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 葛彬
 * @since 2023-07-18
 */
@Service
public class StationServiceImpl extends ServiceImpl<StationMapper, Station> implements IStationService {


    @Override
    public CommonResult findByCity(String city) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("city", city);
//        queryWrapper.eq("city", "天津");
        List<Station> lss = baseMapper.selectList(queryWrapper);
        CommonResult result = new CommonResult(lss);
        if (lss == null || lss.size() == 0)
            result.setNotFound();
        return result;
    }
}
